package weixinkeji.dev.dc.base.scheme.promotions.h.config;

import cache.service.IMYCache;
import weixinkeji.dev.dc.base.scheme.promotions.bean.PromotionConfig;
import weixinkeji.dev.dc.base.scheme.promotions.check.PromotionConfigCheck;
import sys.wx.ann.hm.H;
import sys.wx.ann.hm.M;
import sys.wx.c.ATR;
import sys.wx.c.components.cv.CV;
import sys.wx.m.db.dao.mysql.Dao;
import weixinkeji.dev.dc.base.scheme.promotions.cache.PromotionConfigCache;

@H("weixinkeji/dev/dc/base/scheme/promotions/h/config/u")
public class PromotionConfigHU {

    ATR a;

    public PromotionConfigHU(ATR a) {
        this.a = a;
    }

    @M("/update")//
    public String update() {
        PromotionConfig obj = CV.getObject(PromotionConfig.class, a.request, new PromotionConfigCheck().doPromotionConfig());
        if (null == obj) {
            a.out_OK_NO(false, "您提交的数据存在格式问题。请注意数据字符的输入");
            return null;
        }
        obj.setPromotionConfig_id(((PromotionConfig) IMYCache.get(PromotionConfigCache.KEY)).getPromotionConfig_id());
        a.out_OK_NO(Dao.updateAlloy(obj, "promotionConfig_day_style"));
        IMYCache.remove_event(PromotionConfigCache.KEY);
        return null;
    }
}
